package com.example.lending.Model.Dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Database;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.lending.Model.Book;

import java.util.List;
@Dao
public interface BookDao {
    @Insert
    void insertBook(Book... books);

    @Update
    void updataBook(Book... books);

    @Delete
    void deleteBook(Book... books);

    @Query("delete from book")
    void deleteAllBook();

    @Query("select * from book order by number desc")
    LiveData<List<Book>>getAllBookLive();

    @Query("select * from book where name like :pattern order by id desc")
    LiveData<List<Book>>findBookWithPattern(String pattern);


}
